package com.nulldev.util.uri.yt;

import com.nulldev.util.java.swing.nGetUI;
import com.nulldev.util.uri.URIUtil;
import com.nulldev.util.uri.nget.nGet;

public class YTTest {

	public static void main(String[] args) {
//		final YouTubeExtractor yte = new YouTubeExtractor() {
//			
//			@Override
//			protected void onExtractionComplete(HashMap<Integer, YtFile> ytFiles, VideoMeta videoMeta) {
//				System.out.println("Video Title: " + videoMeta.getTitle());
//				for (final Map.Entry<Integer, YtFile> t : ytFiles.entrySet()) {
//					final Format fx = t.getValue().getFormat();
//					final File f = FileUtil.safeCreate("/tmp/" + videoMeta.getVideoId());
//					if (!f.isDirectory()) {
//						f.mkdir();
//					}
//					final nGet ng = new nGet(URIUtil.safeCreate(t.getValue().getUrl()));
//					final nGetUI ngui = nGetUI.main(ng);
//					ng.setDirectory(f);
//					ng.overrideName(videoMeta.getVideoId() + "_" + fx.getAudioCodec() + "_" + fx.getVideoCodec() + "_" + fx.getHeight() + "." + t.getValue().getFormat().getExt());
//					ng.download();
//					ng.waitTillFinished();
//					ngui.setVisible(false);
//					ngui.dispose();
//				}
//			}
//		};
//		yte.extract("https://hooktube.com/watch?v=LK9qVQ0BqWI", true, true);
		final nGet ng = new nGet(URIUtil.safeCreate("http://ipv4.download.thinkbroadband.com/1GB.zip"));
		final nGetUI ngui = nGetUI.main(ng);
		ng.download();
		ng.waitTillFinished();
		ngui.setVisible(false);
		ngui.dispose();
	}

}
